package cn.ad.enumration;

/**
 * 广告形式， 横幅，插屏，开屏，视频，原生
 * 
 * @author yujuan.zhang
 * @from 2016-06-19
 * @since V1.0
 *
 */
public enum AdFormat {

	ADFORMAT_BANNER(1, "横幅"), 
	ADFORMAT_INTERSTITINAL(2, "插屏"), 
	ADFORMAT_SPREAD(3, "开屏"), 
	ADFORMAT_VIDEO(4, "视频"), 
	ADFORMAT_NATIVE(5, "原生");

	private int value;
	private String description;

    private static java.util.HashMap<Integer, String> mappings;
    
    private synchronized static java.util.HashMap<Integer, String> getMappings() {
        if (mappings == null) {
        	mappings = new java.util.HashMap<Integer, String>();
        	for (AdFormat status : AdFormat.values()) {
        		mappings.put(status.value, status.description);
        	}
        }
        return mappings;
    }

	AdFormat(int value, String description) {
		this.value = value;
		this.description = description;
	}

	public int getValue() {
		return this.value;
	}

	public String getDescription() {
		return this.description;
	}

	@Override
	public String toString() {
		return Integer.toString(this.value);
	}
	
	public static String forValue(int value) {
        return getMappings().get(value);
    }
}
